package org.graduation.recruitment.entity.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import org.graduation.recruitment.entity.pojo.EnterpriseUser;

import java.util.Date;

@Data
@ToString
@Schema(description = "企业用户注册请求体")
public class EnterpriseRegisterDTO extends UserRegisterDTO {
    @Schema(description = "企业名称", required = true)
    private String name;
    @Schema(description = "企业邮箱", required = true)
    private String email;
    @Schema(description = "企业地址")
    private String address;
    @Schema(description = "统一社会信用代码", required = true)
    private String unifiedSocialCreditCode;
    @Schema(description = "企业电话")
    private String phone;
    @Schema(description = "企业地址邮编")
    private String EMSCode;
    @Schema(description = "企业行业")
    private String industryAffiliation;
    @Schema(description = "企业类型")
    private String enterpriseType;
    @Schema(description = "企业注册时间")
    private Date createdDate;
    @Schema(description = "企业联系人", required = true)
    private String contactPerson;
    @Schema(description = "企业描述")
    private String description;

    @Override
    public String getAccount() {
        return getEmail();
    }

    public EnterpriseUser toEnterpriseUser() {
        EnterpriseUser enterpriseUser = new EnterpriseUser();
        enterpriseUser.setName(this.name);
        enterpriseUser.setPassword(getPassword());
        enterpriseUser.setEmail(this.email);
        enterpriseUser.setUnifiedSocialCreditCode(this.unifiedSocialCreditCode);
        enterpriseUser.setEMSCode(this.EMSCode);
        enterpriseUser.setPhone(this.phone);
        enterpriseUser.setIndustryAffiliation(this.industryAffiliation);
        enterpriseUser.setEnterpriseType(this.enterpriseType);
        enterpriseUser.setCreatedDate(this.createdDate);
        enterpriseUser.setContactPerson(this.contactPerson);
        enterpriseUser.setDescription(this.description);
        enterpriseUser.setAddress(this.address);
        return enterpriseUser;
    }
}
